package cn.com.doone.common.uc.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.doone.common.uc.infrastructure.ldap.OAuthRSLdapRepository;
import cn.com.doone.common.uc.service.IUserInfoService;
import cn.com.doone.common.uc.utils.PropertiesUtils;
import cn.com.doone.common.uc.web.dao.UserInfoDao;
@Service("userInfoService")
public class UserInfoServiceImpl implements IUserInfoService {

	@Autowired
	private UserInfoDao userInfoDao;
	
	 @Autowired
	 private OAuthRSLdapRepository oAuthRSLdapRepository;
	    
    @Autowired
    private PropertiesUtils propertiesUtils;
    
	@Override
	public void updateMobilePhone(Map<String, Object> map) {
		userInfoDao.updateMobilePhone(map);
		
		if (propertiesUtils.isLdapEnable()) {
			String tenantFullName = "OU=Account,dc=doone,dc=com,dc=cn";
			try {
				oAuthRSLdapRepository.updateMobilePhone(map, tenantFullName);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
